Skip to content

Fix UIViewControllerHierarchyInconsistency crash in AirshipEmbeddedViewWrapper#732

Merged
crow merged 1 commit intomainfrom
MOBILE-5571
Apr 11, 2026
Merged

Fix UIViewControllerHierarchyInconsistency crash in AirshipEmbeddedViewWrapper#732
crow merged 1 commit intomainfrom
MOBILE-5571

Conversation

@crow
Copy link
Copy Markdown
Contributor

@crow crow commented Apr 9, 2026

What do these changes do?

When AirshipEmbeddedViewWrapper is removed from the window, properly removes the hosted UIHostingController as a child VC before detaching. Also changes parentViewController() to return an optional instead of force-unwrapping.

Why are these changes necessary?

UIHostingController was added as a child VC but never removed on window detach. On the next navigation that re-added it, UIKit threw UIViewControllerHierarchyInconsistency.

How did you verify these changes?

10+ stack push/pop cycles on a screen with an embedded view - no crash with the fix in place.

Verification Screenshots:

Simulator Screenshot - iPhone 16 Pro - 2026-04-09 at 12 27 31

Anything else a reviewer should know?

Tab switching doesn't trigger didMoveToWindow(nil) - only stack push/pop does. Test with a stack navigator, not tabs.

@crow crow requested a review from a team as a code owner April 9, 2026 19:15
@crow crow merged commit d5231d9 into main Apr 11, 2026
1 check passed
@crow crow deleted the MOBILE-5571 branch April 11, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant